package com.tsingteng.cosfun.helper;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;

/**
 * 描述 :
 * 创建人: 肖利.
 * 时间:2018/11/5
 * qq(872179966)
 */

public class RecyclerViewBugLayoutManager extends GridLayoutManager {


    public RecyclerViewBugLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    public RecyclerViewBugLayoutManager(Context context, int spanCount) {
        super(context, spanCount);
    }

    public RecyclerViewBugLayoutManager(Context context, int spanCount, int orientation, boolean reverseLayout) {
        super(context, spanCount, orientation, reverseLayout);
    }

    @Override
    public boolean supportsPredictiveItemAnimations() {
        return false;
    }

    @Override
    public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
        try {
            //把异常抛出来，不至于程序崩溃
            super.onLayoutChildren(recycler, state);
        }catch (IndexOutOfBoundsException e) {
            e.printStackTrace();
        }

    }
}
